import React from "react";
import {LdhFieldSet} from "@biz/PageCompnents";
import {LdhFormItem, LdhInput, LdhPassword,LdhFormItemTip} from "@biz/Components";
import BaseDetailPage from "@biz/BaseDetailPage";
import {createAction} from "../Action";
import Config from "../config";
import Store from "../Store";

const prefix = "shop-account-detail";
export default class ShopAccountDetail extends BaseDetailPage {

    constructor(props) {
        super(props);
        this.action = createAction();
        this.config = Config(this.action);
        this.store = new Store(props, this.config, this.action);
        this.className = prefix;

    }



    renderDetail(isDetail) {
        let {loading, detailStatus} = this.state;
        let isEdit = "edit" == detailStatus;
        let isCreate = "create" == detailStatus;
        return <LdhFieldSet title="基本信息" btn={!isDetail} loading={loading}>



            <LdhFormItem label="姓名" name="username" required isDetail={isDetail}>
                <LdhInput maxLength={12} showCount/>
            </LdhFormItem>

            <LdhFormItem label="登录账号" name="account" required isDetail={isDetail}>
                <LdhInput maxLength={11} showCount/>
            </LdhFormItem>

            {
                isDetail ||  <LdhFormItem label="登录密码" name="newPassword" required={isCreate} isDetail={isDetail}>
                    <LdhPassword />
                </LdhFormItem>

            }
            {isEdit && <LdhFormItemTip>编辑时，若密码为空，则使用原密码</LdhFormItemTip>}



        </LdhFieldSet>

    }
}